import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 高生平
 * Date: 2025-09-05
 * Time: 20:25
 */
public class Test {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        System.out.println(n + "年到" + m + "年之间所有的闰年从小到大依次为：");
        for (int i = n; i <= m ; i++) {
            if ((i % 100 != 0 && i % 4 == 0) || (i % 400 == 0)) {
                System.out.print(i + "年 ");
            }
        }
    }
}
